home *** CD-ROM | disk | FTP | other *** search
Text File | 1986-05-11 | 77.0 KB | 2,039 lines |
-
-
-
- PTOOLS - PASCAL SOFTWARE WRITING TOOLS. 03 Jan 79
-
- PASCAL TTTTTTTT OOOOO/ OOOOO/ LL SSSSS
- PP PP TT OO OO OO OO LL SS SS
- AA AA TT OO /OO OO /OO LL SS
- SSSSSS SOFTWARE TT OO / OO OO / OO LL SSSSS
- CC TT OO/ OO OO/ OO LL SS
- AA TT OO OO OO OO LL SS SS
- LL TT /OOOOO /OOOOO LLLLLLL SSSSS
-
- THIS IS THE PTOOLS WRITEUP 79/01/01.
- - ANDY MICKEL
- - JOHN P. STRAIT
- - RICK L. MARCUS
- - UNIVERSITY COMPUTER CENTER
- - UNIVERSITY OF MINNESOTA
-
- THE PTOOLS WRITEUP DESCRIBES VARIOUS SOFTWARE-WRITING TOOLS WHICH
- AID THE PASCAL PROGRAMMER IN ALL PHASES OF PROGRAM CODING AND
- DEVELOPMENT--FROM ENTRY OF SOURCE CODE THROUGH DOCUMENTATION. THIS
- SHEET IS MERELY THE TABLE OF CONTENTS FOR ALL OF THE TOOLS AVAILABLE.
-
- NAME PAGES DESCRIPTION
- ---- ----- -----------
-
- COMPARE 5 COMPARE TWO TEXTFILES AND REPORT THEIR DIFFERENCES.
-
- MEASURE 5 OBTAIN PERFORMANCE MEASUREMENTS OF A PASCAL PROGRAM
- USING AUGMENT AND ANALYZE.
-
- PASCODE 1 DECOMPILE A RELOCATABLE-BINARY FILE PRODUCED BY THE
- PASCAL COMPILER.
-
- PASCREF 2 CROSS REFERENCE IDENTIFIERS IN A PASCAL PROGRAM AND
- GIVE A PROCEDURE MAP.
-
- PASVERT 2 CONVERT A TEXTFILE FROM/TO CDC SCIENTIFIC CHARACTER
- SET TO/FROM CDC ASCII SUBSET CHARACTER SET.
-
- PRETTY 3 PRETTYPRINT (AUTOMATICALLY INDENT) A PASCAL PROGRAM.
-
- SPRUCE 10 PRETTYPRINT (AUTOMATICALLY INDENT AND FORMAT) A
- PASCAL PROGRAM ACCORDING TO VARIOUS OPTIONS.
-
- WRITE 6 TRANSLATE CHARACTER SETS IN WRITEUPS.
-
- AT THE UNIVERSITY OF MINNESOTA THIS DOCUMENT IS AVAILABLE AS AN
- INDEXED WRITEUP WITH CHAPTERS OF A FEW PAGES EACH. THIS ALLOWS THE
- RETRIEVAL OF SELECTED CHAPTERS OR THE ENTIRE WRITEUP. TO GET A
- WRITEUP OF A SPECIFIC TOOL AT THE UNIVERSITY OF MINNESOTA, USE ONE OF
- THE COMMANDS BELOW. AT OTHER SITES, THE METHOD TO RETRIEVE SEPARATE
- CHAPTERS MAY BE DIFFERENT OR IMPOSSIBLE.
-
- WRITEUP(PTOOLS=NAME) - PRINT THE WRITEUP FOR "NAME".
- WRITEUP(PTOOLS=NAME1+...+NAMEN) - PRINT THE NAMED TOOLS.
- WRITEUP(PTOOLS=*) - PRINT THE ENTIRE PTOOLS WRITEUP.
-
-
- - 1 -
-
-
- COMPARE - Compare Two Textfiles 03 Jan 79
-
- Compare - Compare Two Textfiles and Report Their Differences
-
- James F. Miner
- Social Science Research Facilities Center
- Andy Mickel
- University Computer Center
- University of Minnesota
- Minneapolis, MN 55455 USA
-
- Copyright (c) 1977, 1978.
-
- What COMPARE Does
- -----------------
-
- COMPARE is used to display the differences between two similar
- texts (referred to as "FILEA" and "FILEB"). Such textfiles could be
- Pascal source programs, character data, documentation, etc.
-
- COMPARE is line-oriented, meaning the smallest unit of comparison
- is the text line (ignoring trailing blanks). COMPARE generates a
- report of differences (mismatches or extra text) between the two
- textfiles. The criterion for determining the locality of differences
- is the number of consecutive lines on each file which must match after
- a prior mismatch, and can be selected as a parameter.
-
- By selecting other parameters, you can direct COMPARE to restrict
- the comparison to various linewidths, mark column-wise the differences
- in pairs of mismatched lines, generate text-editor directives to be
- used to convert FILEA into FILEB, or generate a listing which will
- flag lines on FILEB indicating their addition or deletion as a result
- of the application of the editor directives.
-
- How to Use COMPARE
- ------------------
-
- COMPARE is available as an operating system control statement on
- CDC 6000/Cyber 70,170 computer systems. The general form of the
- control statement is:
-
- COMPARE(a,b,list,modfile/options)
-
- COMPARE. means COMPARE(FILEA,FILEB,MODS/C6,D,W120)
-
- "FILEA" and "FILEB" are the names of the two textfiles being
- compared, "OUTPUT" is the report file, and "MODS" is the file name for
- the generation of text-editor directives if the "M" option is
- selected--see below. The various options are: C, D, F, M, P, and W.
-
-
-
- - 1 -
-
-
- COMPARE - Compare Two Textfiles 03 Jan 79
-
- Cn Match Criterion (1 <= n <= 100).
- C determines the number of consecutive lines on each file
- which must match in order that they be considered as
- terminating a prior mismatch. C therefore affects COMPARE's
- "sensitivity" to the "locality" of differences. Setting C to
- a large value tends to produce fewer (but longer) mismatches
- than does a small value. C6 appears to give good results on
- Pascal source files, but may be inappropriate for other
- applications.
- Default: C6.
-
- D Report Differences.
- D directs COMPARE to display mismatches and extra text
- between FILEA and FILEB in a clearly annotated report. Only
- one of D, F, or M can be explicitly selected at one time.
- Default: selected.
-
- F Select Flag-form output.
- F directs COMPARE to list FILEB annotated with lines prefixed
- by an "A" or "D" indicating "additions" or "deletions"
- respectively. Such modifications could have been generated
- with the M option. Only one of D, F, or M can be explicitly
- selected at one time.
- Default: not selected.
-
- M Produce MODS file.
- M directs COMPARE to produce a file of "INSERT" or "DELETE"
- directives ready for the CDC MODIFY or UPDATE text editors
- (an "IDENT" directive must be added). The insertions and
- deletions will convert FILEA into FILEB. FILEA and FILEB
- should be files with sequencing appearing in columns beyond
- the linewidth specified by the W option. This is true of
- MODIFY and UPDATE "COMPILE" files (W72 is recommended).
- Sequence numbers are of the form:
-
- {Blanks} IdentName {Blanks} UnsignedInteger.
-
- Only one of D, F, or M can be explicitly selected at one
- time.
- Default: not selected.
-
- P Mark Pairs of mismatched lines.
- P alters the action of the D directive by marking differing
- columns in pairs of lines which mismatch in sections of equal
- length. This is especially useful for comparing packed data
- files.
- Default: not selected.
-
- Wn Specify significant line Width (length) (10 <= n <= 150).
- W determines the fixed number of columns of each line which
- will be compared. W is ideal to use when sequence informa-
- tion is present at the right edge of the text file.
- Default: W120.
-
-
-
- - 2 -
-
-
- COMPARE - Compare Two Textfiles 03 Jan 79
-
- Example
- -------
-
- Suppose FILEA is:
-
- PROGRAM L2U(INPUT, OUTPUT);
- (* CONVERT CDC 6/12-ASCII LOWER-CASE
- LETTERS TO UPPER CASE. *)
- BEGIN
- WHILE NOT EOF(INPUT) DO
- BEGIN
- WHILE NOT EOLN(INPUT) DO
- BEGIN
- IF INPUT^ <> CHR(76) THEN WRITE(INPUT^);
- GET(INPUT)
- END;
- READLN;
- WRITELN
- END;
- (*ALL DONE.*)
- END.
-
-
-
- and FILEB is:
-
- PROGRAM U2L(INPUT, OUTPUT);
- (* CONVERT CDC ASCII UPPER-CASE LETTERS
- TO 6/12 LOWER CASE. *)
- BEGIN
- WHILE NOT EOF(INPUT) DO
- BEGIN
- WHILE NOT EOLN(INPUT) DO
- BEGIN
- IF INPUT^ IN ['A'..'Z'] THEN WRITE(CHR(76));
- WRITE(INPUT^);
- GET(INPUT)
- END;
- READLN;
- WRITELN
- END;
- END.
-
-
-
-
-
-
-
- - 3 -
-
-
- COMPARE - Compare Two Textfiles 03 Jan 79
-
- then a report from COMPARE looks like this:
-
- COMPARE,L2U,U2L,LIST/C1,D,P. 78/12/31. 20.23.25.
- COMPARE VERSION 3.0 CDC (78/12/19)
-
- OUTPUT OPTION = DIFFERENCES.
- INPUT LINE WIDTH = 120 CHARACTERS.
- MATCH CRITERION = 1 LINES.
-
- FILEA: L2U
- FILEB: U2L
-
- ***********************************
- MISMATCH: L2U LINES 1 THRU 3 <NOT EQUAL TO> U2L LINES 1 THRU 3:
-
- A 1. PROGRAM L2U(INPUT, OUTPUT);
- B 1. PROGRAM U2L(INPUT, OUTPUT);
- ^ ^
-
- A 2. (* CONVERT CDC 6/12-ASCII LOWER-CASE
- B 2. (* CONVERT CDC ASCII UPPER-CASE LETTERS
- ^^^^^^^^^^^^^^^^^^^^^^^^
-
- A 3. LETTERS TO UPPER CASE. *)
- B 3. TO 6/12 LOWER CASE. *)
- ^^^^^^^ ^ ^^^^^^^^^^^^ ^^
-
- ***********************************
- MISMATCH: L2U LINE 9 <NOT EQUAL TO> U2L LINES 9 THRU 10:
-
- A 9. IF INPUT^ <> CHR(76) THEN WRITE(INPUT^);
-
- B 9. IF INPUT^ IN ['A'..'Z'] THEN WRITE(CHR(76));
- B 10. WRITE(INPUT^);
-
- ***********************************
- EXTRA TEXT ON L2U, BETWEEN LINES 15 AND 16 OF U2L
-
- A 15. (*ALL DONE.*)
-
- How COMPARE Works
- -----------------
-
- COMPARE employs a simple backtracking-search algorithm to isolate
- mismatches from their surrounding matches. Each mismatch requires
- dynamic storage roughly proportional to the size of the largest
- mismatch, and time roughly proportional to the square of the size of
- the mismatch. Thus it may not be feasible to use COMPARE on files
- with very long mismatches.
-
-
-
-
- - 4 -
-
-
- COMPARE - Compare Two Textfiles 03 Jan 79
-
- History
- -------
-
- COMPARE was developed as a portable-Pascal software tool by James
- Miner of the Social Science Research Facilities Center at the
- University of Minnesota, in early 1977. It was written in standard
- Pascal and developed initially under CDC 6000 Pascal. Although the
- original version simply reported differences in a textfile, COMPARE
- was designed to fit naturally into a larger text-editing system.
- Plans for COMPARE's accommodating later enhancements to generate
- text-editor directives were made from the beginning. In summer of
- 1977, John Strait at the University of Minnesota Computer Center
- adapted COMPARE not only to generate such a modifications file, but
- also flag-form output and user-selectable options.
-
- COMPARE has been distributed to several Pascal enthusiasts in the
- United States who have made it operational on other Pascal implementa-
- tions. See Pascal News #12, May, 1978, pages 20-23. In late 1978,
- Willett Kempton of the Anthropology Department at the University of
- California Berkeley, installed COMPARE (with no changes required
- whatsoever) under Berkeley UNIX Pascal on a PDP 11/70 computer system.
- He later adapted the program to note column-wise differences in pairs
- of different lines and made minor changes to the format of the report.
-
- Rick Marcus and Andy Mickel at the University of Minnesota
- Computer Center made minor enhancements to COMPARE and fully documen-
- ted it it for Release 3 of Pascal 6000 in December, 1978.
-
- COMPARE is a model program in many respects. It serves to
- illustrate just how powerful and flexible such a comparison program
- can be.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - 5 -
-
-
- MEASURE - Performance Measurement of Pascal Programs 03 Jan 79
-
- PERFORMANCE MEASUREMENT OF PASCAL PROGRAMS
- USING AUGMENT AND ANALYZE
-
- - Andy Mickel 78/03/14.
- University Computer Center
- University of Minnesota
- Minneapolis, MN 55455
-
- What AUGMENT and ANALYZE Do
- ---------------------------
-
- Suppose you want to examine the execution efficiency of your
- Pascal program--perhaps to make improvements to those parts which take
- the most computer time.
-
- AUGMENT and ANALYZE are designed to obtain rough measures of such
- execution times, particularly for large Pascal programs. Unlike other
- kinds of performance measurement, AUGMENT and ANALYZE assume the
- PROCEDURE and FUNCTION to be the smallest unit of a program to be
- monitored. This is a satisfactory assumption because well-written
- Pascal programs produced by stepwise refinement naturally are composed
- of proper-sized procedures and functions.
-
- The general principle used by these programs is that the value of
- the non-standard Pascal function CLOCK (which returns the elapsed
- processing time in milliseconds) can be sampled at procedure or
- function entry and exit. When the the expression (exittime -
- entrytime), is evaluated the time spent within the particular proce-
- dure or function can be ascertained.
-
- AUGMENT is the program which inserts the necessary CLOCK-sampling
- code into your Pascal source program for every procedure and function
- entry and exit. It thus causes your program to capture timing
- information and to write it out to a file.
-
- Next you compile and execute your program, which actually
- produces the file of dynamic timing measurements.
-
- ANALYZE then reads the timing file produced, and writes a report,
- which gives the name of each procedure or function, the number of
- times it was called, and the execution time it consumed for all calls
- and per call.
-
- AUGMENT and ANALYZE therefore provide a nearly machine-indepen-
- dent method for gathering performance-measurement data about a Pascal
- program. Most Pascal implementations have the required CLOCK function
- which returns the elapsed processor time in milliseconds.
-
- It is sometimes necessary to exclude the monitoring of excessive-
- ly called procedures and functions in large programs. A feature of
- AUGMENT allows you to specify any number of names to be excluded.
-
-
-
- - 1 -
-
-
- MEASURE - Performance Measurement of Pascal Programs 03 Jan 79
-
- How to Use AUGMENT and ANALYZE
- ------------------------------
-
- Under CDC 6000/Cyber 70,170 computer systems, AUGMENT and ANALYZE
- are control statements. Thus the following batch commands do the job:
-
- FETCH(AUGMENT,ANALYZE)
- AUGMENT(the file name of your Pascal source program)
- PASCAL(INTER/L-,G+)
- ANALYZE.
-
- The program headings for AUGMENT and ANALYZE are:
-
- AUGMENT(INPUT, EXCEPT, INTER, INTER2, OUTPUT) where:
-
- INPUT is the textfile containing the Pascal source program to be
- augmented.
-
- EXCEPT is the textfile containing a list of names (one to a line
- with no leading blanks) of procedures and functions to be
- excluded from measurement. EXCEPT can be an empty file in
- which case no procedures or functions will be excluded.
-
- INTER is the textfile on which the augmented version of the
- Pascal source program is written.
-
- INTER2 is the binary file on which only the names of each
- procedure and function in the Pascal source program is
- written for use by ANALYZE.
-
- OUTPUT is the textfile on which error messages are written if
- problems occur during augmenting. A report is written on
- OUTPUT verifying which procedures or functions were exclu-
- ded, if any.
-
- The error messages from AUGMENT are:
-
- *** TOO MANY PROCEDURES AND FUNCTIONS TO AUGMENT. (A limit of
- 2000 is imposed.)
-
- *** "BEGIN" EXPECTED.
-
- *** "END" EXPECTED. (There is something wrong with the statement
- part of the Pascal source program which is being augmented;
- it began with some reserved word other than "BEGIN" or
- there weren't enough "END"s to match "BEGIN"s.)
-
- *** "PROGRAM" EXPECTED. (AUGMENT couldn't find "PROGRAM" as the
- first reserved word in the Pascal source program. Possibly
- the INPUT file was empty.)
-
- *** UNDECLARED LABEL: xxx (AUGMENT couldn't find a label referred
- to by a GOTO statement.)
-
-
-
- - 2 -
-
-
- MEASURE - Performance Measurement of Pascal Programs 03 Jan 79
-
- ANALYZE(OUTPUT, INTER2, TIMING) where:
-
- OUTPUT is the textfile on which the performance measurement report
- is written or alternatively the error message:
- *** TIMING FILE EMPTY.
-
- INTER2 is the binary file on which the names of each procedure and
- function in the Pascal source program was written by
- AUGMENT.
-
- TIMING is the binary file containing the dynamic timing measure-
- ments resulting from execution of the augmented Pascal
- program.
-
- Note: The identifier "TIMING" is added to the Pascal source
- program by AUGMENT and must not appear in any procedure or function
- which is to be monitored. When you use AUGMENT and ANALYZE, it is
- probably a good idea to consider the file names INTER, INTER2, and
- TIMING reserved.
-
- In summary, there are four steps to the performance measurement
- process:
-
- 1) [Pascal source program] -> AUGMENT -> INTER and INTER2
- *******
-
- 2) INTER -> PASCAL Compiler -> [Pascal binary program]
- ***************
- 3) [input data for
- Pascal program] -> Pascal binary program -> TIMING and [results
- ********************* from Pascal program]
-
- 4) TIMING and INTER2 -> ANALYZE -> [performance measurement
- ******* report]
-
- EXAMPLE
- -------
- Below are a test program, its augmented version, and the
- performance measurement report:
-
- The source of the test program:
-
- PROGRAM TEST(OUTPUT);
- LABEL 5;
- VAR N: INTEGER;
-
- PROCEDURE A;
-
- PROCEDURE B;
- BEGIN N := N + 1;
- IF ODD(N DIV 2) THEN A ELSE B
- END (*B*) ;
-
- BEGIN (*A*)
- N := N + 1;
-
- - 3 -
-
-
- MEASURE - Performance Measurement of Pascal Programs 03 Jan 79
-
- IF N > 200 THEN GOTO 5;
- B
- END (*A*) ;
- BEGIN N := 0; A; 5: END.
-
-
-
-
- The augmented version of the test program:
-
- PROGRAM TEST(OUTPUT,TIMING);
- LABEL 5;
- VAR
- TIMING:FILE OF PACKED RECORD I:0..2000;T:0..99999999;M:0..2 END;
- N: INTEGER;
-
- PROCEDURE A;
-
- PROCEDURE B;
- BEGIN
- WITH TIMING^ DO BEGIN I:= 3;T:=CLOCK;M:=0 END;PUT(TIMING);
- N := N + 1;
- IF ODD(N DIV 2) THEN A ELSE B
- ;
- WITH TIMING^ DO BEGIN I:= 3;T:=CLOCK;M:=1 END;PUT(TIMING)
- END
- (*B*) ;
-
- BEGIN
- WITH TIMING^ DO BEGIN I:= 1;T:=CLOCK;M:=0 END;PUT(TIMING);
- (*A*)
- N := N + 1;
- IF N > 200 THEN BEGIN
- WITH TIMING^ DO BEGIN I:= 2;T:=CLOCK;M:=2 END;PUT(TIMING);
- GOTO 5 END
- ;
- B
- ;
- WITH TIMING^ DO BEGIN I:= 2;T:=CLOCK;M:=1 END;PUT(TIMING)
- END
- (*A*) ;
- BEGIN REWRITE(TIMING);
- WITH TIMING^ DO BEGIN I:= 1;T:=CLOCK;M:=0 END;PUT(TIMING);
- N := 0; A; 5: ;
- WITH TIMING^ DO BEGIN I:= 1;T:=CLOCK;M:=1 END;PUT(TIMING)
- END
- .
-
-
-
-
- - 4 -
-
-
- MEASURE - Performance Measurement of Pascal Programs 03 Jan 79
-
- The report from ANALYZE:
-
- PERFORMANCE MEASUREMENT SUMMARY FOR PASCAL PROGRAM: TEST .
-
- EXECUTION TIME
- CALLS (MILLISECONDS)
- MODULE TIMES PERCENT AVERAGE MODULE PERCENT
- NAME CALLED OF TOTAL PER CALL TOTAL OF TOTAL
- ---------- ------ -------- -------- ------ --------
- A 52 25.490 0.15 8 27.586
- B 151 74.020 0.13 20 68.966
- TEST 1 0.490 1.00 1 3.448
- ========== ====== ======== ======== ====== ========
- TOTALS 204 100.000 0.14 29 100.000
-
- From the summary provided by AUGMENT and ANALYZE, you can
- identify which procedures and functions to improve for greater
- execution efficiency. In general, it pays to concentrate on proce-
- dures and functions which are frequently called and take a significant
- amount of the total execution time of the program. Procedures and
- functions which have a large average execution time per call, but
- which are only called a few times are not worth worrying about.
-
- If one or more procedures or functions seem to dominate the
- results, it might be a good idea to monitor the program with these
- modules excluded from measurement. Use the except feature provided by
- AUGMENT.
-
- History
- -------
- AUGMENT and ANALYZE were conceived originally under the names
- PROFILE and PRINRES in 1975-1976 by S. Matwin and M. Missala, of the
- Polish Academy of Sciences Computer Centre, PKiN, Warwaw, Poland. The
- goal of the project was to build a simple tool to measure very large
- programs--such as the Pascal 6000 compiler itself. A paper describing
- their successful work entitled: "A Simple, Machine Independent Tool
- for Obtaining Rough Measures of Pascal Programs," appeared in SIGPLAN
- Notices (11:8) August, 1976, pages 42-45.
-
- In 1976, Richard J. Cichelli of Lehigh University Mathematics
- Department and the American Newspaper Publishers Association Research
- Institute, obtained the programs and documented and distributed them
- to the Pascal community in the United States.
-
- In 1977, Herb Rubenstein and Andy Mickel of the University of
- Minnesota Computer Center, modified the programs for coding style and
- to increase portability, fixed bugs, and improved the performance of
- the programs themselves. We also removed several limitations (the
- built-in restrictions regarding the use of non-local GOTOs within
- procedures and functions as well as the monitoring of procedures named
- NEXTCH). See "Pascal News" 12, May, 1978, page 23.
-
- The programs are now supported with the Pascal-6000 system which
- is distributed to CDC installations around the world.
-
-
- - 5 -
-
-
- PASCODE - List Relocatable-Binary Code in Symbolic Form 03 Jan 79
-
- PASCODE - List Relocatable-Binary Code in Symbolic Form
-
- J. P. Strait
- University Computer Center
- University of Minnesota
-
- Copyright (C) University of Minnesota - 1978
-
- PASCODE lists relocatable-binary code produced by the Pascal 6000
- compiler in pseudo-COMPASS form. To conserve space, one word of
- instructions is printed per line in columns which correspond to the
- four parcels in central memory words. If PASCODE is presented with a
- Pascal binary which was not compiled with post-mortem dump info
- entirely suppressed, it is able to differentiate between code,
- constants and post-mortem dump info. If it is presented with a
- non-Pascal binary, or one compiled with PMD info suppressed (Pascal
- compiler option P0, see the Pascal writeup), PASCODE will print every
- word in both octal and pseudo-COMPASS.
-
- PASCODE prints correct pseudo-COMPASS for Pascal binaries, and
- does fairly well for non-Pascal binaries. PASCODE does not handle all
- of the defined loader tables, only those that the Pascal compiler
- produces. It does not handle more than one external reference applied
- to a single address field, nor does it handle an external reference
- and program relocation applied to the same address field. Common
- blocks are not handled. Only one entry point is recognized in each
- relocatable record. Each procedure is assumed to be terminated by an
- End-Of-Record mark.
-
- In particular, the only loader tables that are processed are:
-
- 3400 - PIDL - Program identification and length.
- 3600 - ENTR - Entry point definitions.
- 4000 - TEXT - Relocatable text.
- 4300 - REPL - Replication of text.
- 4400 - LINK - External reference linkage.
- 7700 - PRFX - Prefix.
-
- All other tables are ignored.
-
-
- The program heading of PASCODE is:
-
- PROGRAM PASCODE(LGO,OUTPUT)
-
- and so to decode a binary on file LGO use the control statement:
-
- FETCH(PASCODE)
- PASCODE.
-
- and to decode a binary on file ABC use the control statement:
-
- FETCH(PASCODE)
- PASCODE(ABC)
-
-
- - 1 -
-
-
- PASCREF - CROSS REFERENCE PASCAL PROGRAMS. 03 Jan 79
-
- PASCREF -- A Cross-Reference-Listing Generator for Pascal Programs
-
- - Andy Mickel 78/07/12.
- - University Computer Center
- - University of Minnesota
-
- What PASCREF Does
- -----------------
-
- PASCREF is a software tool used to produce cross-reference
- listings of identifiers in a Pascal program. PASCREF lists the input
- program and numbers each line. Below the listing a table of all
- identifiers (except reserved words) is given together with a series of
- line numbers which identify each appearance of the identifier in the
- program. Generally, the first occurrence of each identifier denotes
- the line on which it was declared. Two exceptions to the exclusion of
- reserved words in the table are references to the symbols "LABEL" and
- "GOTO". Their inclusion is useful because they should be used
- carefully in a Pascal program. Any non-standard Pascal 6000 reserved
- words also appear in the cross-reference table. Following the
- cross-reference listing, a map of procedures and functions is given to
- aid their lookup in large programs.
-
- Facts About PASCREF
- -------------------
-
- 1) The listing produced is paged to fit in top-binding folders--
- perfect for nice "permanent" listings for reference use.
- 10) PASCREF can handle programs up to 100000 lines long and up to
- approximately 1500 identifiers.
- 3) The execution time for running PASCREF across the Pascal compiler
- (an 8000-line program) was 17.8 seconds on a Cyber 74.
- 4) The memory required to run PASCREF is proportional to the total
- number of identifiers and identifier occurrences in the program to
- be cross-referenced. For the 400-line PASCREF program itself,
- CM20000 was sufficient.
-
- How to Use PASCREF
- ------------------
-
- PASCREF is available as a batch control statement under CDC
- operating systems. Its program heading is: XREF(INPUT,OUTPUT). The
- general form of the PASCREF control statement is:
-
- PASCREF(ProgramFileName, X-RefListingFileName/ Parameters)
-
- Two optional parameters are available: "W" and "U". U controls
- the width of each input line scanned: U+ = 72, U- = 120; default is
- U-. W controls the width of the cross-reference table written after
- the numbered program listing: W+ = 72, W- = 136; default is W-. W-
- generates nesting level indicators to the right of the listing
- annotating "BEGIN-END", "REPEAT-UNTIL", and "CASE-END" pairs. There-
- fore the default PASCREF control statement is:
-
- PASCREF(INPUT,OUTPUT/U-,W-)
-
-
- - 1 -
-
-
- PASCREF - CROSS REFERENCE PASCAL PROGRAMS. 03 Jan 79
-
- To compile and run a Pascal program with a cross-reference
- listing, use the following command sequence:
-
- PASCAL,,LIST.
- PASCREF(LIST)
- LGO.
-
- PASCREF may produce the following error messages:
-
- 1) "TABLE FULL" (caused by too many identifiers).
- 2) "TEXT TOO LONG" (program length was more than 100000 lines).
- 3) "NO PROGRAM FOUND TO CROSS REFERENCE" (an empty file was given as
- input).
-
- Also a workspace overflow may result if insufficient memory is
- given to PASCREF.
-
- History
- -------
-
- PASCREF was first written in January, 1971 by Niklaus Wirth at
- the Institut fur Informatik, E.T.H. Zurich. He revised it several
- times over the years for inclusion with subsequent releases of the
- Pascal 6000 compiler. The major improvement was employing a quicksort
- procedure in 1975. The program was modified slightly by Andy Mickel,
- Dan LaLiberte, and John Strait at the University of Minnesota to
- process a compiler listing with line numbers and titles and to append
- a map of procedures and functions. For more information see the book:
- "Algorithms + Data Structures = Programs," chapter 4, by Niklaus
- Wirth, Prentice Hall, 1976.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - 2 -
-
-
- PASVERT - Pascal Program Character Set Conversion 03 Jan 79
-
- PASVERT - Pascal Program Character Set Conversion
-
- J. P. Strait
- University Computer Center
- University of Minnesota
-
- Copyright (C) University of Minnesota - 1978
-
- Program PASVERT reads a Pascal program written in either the CDC
- scientific character set or the CDC ASCII subset, and performs the
- required conversions to write the program in the other character set.
- It automatically supplies the appropriate "A" compiler option as the
- first line of the newly converted Pascal source program.
-
- The conversions for scientific to ASCII are-
-
- Pascal Symbol Old Name New Name
- ------------- -------- --------
- string delimiter 60B equivalence 70B single quote
- not equal 64B not equal <>
- open comment 65B right arrow (*
- close comment 71B down arrow *)
- or 66B logical or OR
- and 67B logical and AND
- not 76B logical not NOT
- pointer 70B up arrow 76B circumflex
- less or equal 74B less or equal <=
- greater or equal 75B greater or equal >=
-
- The conversions for ASCII to scientific are-
-
- Pascal Symbol Old Name New Name
- ------------- -------- --------
- string delimiter 70B single quote 60B equivalence
- pointer 76B circumflex 70B up arrow
-
- Characters within comments are converted, but those within
- strings are left alone. PASVERT requires a syntactically-correct
- (compilable) Pascal program as input. It performs no error checking.
-
- The program heading for PASVERT is-
-
- PROGRAM PASVERT(INPUT+,OUTPUT+)
-
- and so the control statement call is-
-
- PASVERT(IN,OUT/+) -or- PASVERT(IN,OUT/-)
-
- where "IN" is the file you want to convert, and "OUT" is the result.
- "IN" and "OUT" may not be the same actual file name. The character
- ('+' or '-') after the slash selects the conversion by indicating the
-
- - 1 -
-
-
- PASVERT - Pascal Program Character Set Conversion 03 Jan 79
-
- appropriate setting of the "A" compiler option for the output file.
- That is, '+' selects a conversion from scientific to ASCII, and '-'
- selects a conversion from ASCII to scientific. The default value of
- this option is '+'.
-
- The input file is rewound before processing unless its name is
- actually "INPUT". The output file is not rewound. Conversion is done
- until an end-of-file mark is reached, but all logical record marks
- within that file are preserved.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- - 2 -
-
-
- PRETTY - Pascal Prettyprinting Program 03 Jan 79
-
- PRETTY - Pascal Prettyprinting Program
-
- - Jon Hueras and
- Henry Ledgard 76/08/01.
- - Rick L. Marcus 78/09/15.
-
- What PRETTY Does
- ----------------
-
- PRETTY takes as input a Pascal program or program fragment and
- reformats it according to a standard set of prettyprinting rules. The
- prettyprinted program is given as output. PRETTY makes no attempt to
- detect or correct syntactic errors in your program. However, syntac-
- tic errors may result in erroneous prettyprinting.
-
- PRETTY differs from some other prettyprinting programs in that it
- does not reformat your program "right down to every last semicolon."
- Such a philosophy requires formatting everything in a rigid fashion
- which is bound to be displeasing, or else it must provide you with a
- voluminous set of "options." Furthermore, such a scheme must do full
- syntax analysis of the program which means that it must be completely
- written and compilable. If you wish to prettyprint a program still
- under development, then you are out of luck.
-
- PRETTY, on the other hand, implements a strategy which states
- that it is not necessary to impose more than a "minimum" set of
- restrictions, and the prettyprinter should yield to your discretion
- beyond this minimum. PRETTY preserves blank lines and extra spaces
- you insert in the program as input, besides adding blank lines and
- extra spaces according to the rules for prettyprinting given below.
-
- General prettyprinting rules:
-
- 1. Spaces and blank lines already in your program are preserved by
- PRETTY, which adds (but does not subtract) blank lines and spaces.
- You can improve the readability of your programs by taking advantage
- of this feature.
-
- 2. All statements and declarations begin on separate lines.
-
- 3. No input line may be longer than 80 characters. Any output line
- longer than 80 characters is continued on a separate line.
-
- 4. The keywords "BEGIN", "END", "REPEAT", and "RECORD" are forced to
- stand on lines by themselves (or possibly followed by supporting
- comments). In addition, the "UNTIL" clause of "REPEAT-UNTIL"
- statement is forced to start on a new line.
-
- 5. A blank line is forced before the keywords "PROGRAM", "PROCEDURE",
- "FUNCTION", "LABEL", "CONST", "TYPE", and "VAR".
-
- 6. A space is forced before and after the symbols ":=" and "=".
- Additionally, a space is forced after the symbol ":". Note that
- only "="s in declarations are formatted; "="s in expressions are
- ignored.
-
-
- - 1 -
-
-
- PRETTY - Pascal Prettyprinting Program 03 Jan 79
-
- Indentation rules:
-
- 1. The body of a declaration is indented from the "LABEL", "CONST",
- "TYPE", or "VAR" keyword which heads it.
-
- 2. The bodies of "BEGIN-END", "REPEAT-UNTIL", "WHILE", "WITH", and
- "CASE" statements, as well as "RECORD-END" structures and "CASE"
- variants (to one level) are indented from keywords which head them.
-
- 3. An "IF-THEN-ELSE" statement is indented as follows:
-
- IF <expression>
- THEN
- <statement>
- ELSE
- <statement>
-
- How to Use PRETTY
- -----------------
-
- PRETTY is available as a KRONOS/NOS control statement on CDC
- 6000/Cyber 70,170 computer systems. Two file names are required: the
- local file name of program to be prettyprinted, and the local file
- name for the prettyprinted listing. The general form is:
-
- PRETTY(myprog,newprog)
-
- The parameters "myprog" and "newprog" are optional but must be
- specified in the order given. If "myprog" is omitted, the filename,
- INPUT, is assumed. If "newprog" is omitted, the filename, OUTPUT, is
- assumed. Data on INPUT is by convention from cards or an interactive
- terminal; data on OUTPUT goes to the line printer or to an interactive
- terminal. PRETTY formats only one record of the file named INPUT.
-
- ***NOTE***
-
- You must delete line numbers from your program if you wish to use
- PRETTY. Use your favorite text editor. If the line numbers are not
- deleted the result will not be "pretty," nor will it compile.
-
- When to Use PRETTY
- ------------------
-
- PRETTY is especially useful to reformat a Pascal program or
- program fragment that you have typed without regard to formatting
- (such as entering every line left-justified to save time). Because
- the program need not be syntactically correct, PRETTY provides the
- fastest means of obtaining a more readable version of your program.
-
- PRETTY is best used to prettyprint a Pascal program already on a
- file or punched on cards. PRETTY changes neither the cards nor the
- file used as input. Prettyprinting a program line-by-line as it is
- entered at a terminal is considerably less useful.
-
-
-
- - 2 -
-
-
- PRETTY - Pascal Prettyprinting Program 03 Jan 79
-
- Examples
- --------
-
- For Interactive Processing:
-
- 1. A Pascal program (or fragment) is on the file "myprog" and the
- desired prettyprinted listing is to be on the file "newprog":
-
- old,myprog -or- get,myprog (if myprog is not already a local
- x,rfl,20000 file)
- x,pretty(myprog,newprog)
-
- "newprog" is now the prettyprinted version of myprog.
-
- For Batch Processing:
-
- 2. A program is on cards (file INPUT) and the prettyprinted program
- is to be on the printer (file OUTPUT). The command sequence is:
-
- JOB statement.
- USER statement.
- PRETTY.
- 7-8-9 end of record
- Pascal program
- 6-7-8-9 end of information
-
- 3. In the same run as a compile and execute, a Pascal program is
- prettyprinted:
-
- JOB statement.
- USER statement.
- PRETTY,,TEMP. ("TEMP" here directs PRETTY to put the pretty-
- printed results on a file named TEMP.)
- PASCAL,TEMP.
- LGO.
- 7-8-9
- Pascal Program
- 7-8-9
- data, if any
- 6-7-8-9
-
- History
- -------
-
- PRETTY prettyprints a Pascal program or program fragment given as
- input. It was originally named PRETTYPRINT and was written in Pascal
- by Jon Hueras and Henry Ledgard, University Computing Center and
- Computer and Information Science Dept., University of Massachusetts at
- Amherst, in August, 1976. (See "An Automatic Formatting Program for
- Pascal", by Jon Hueras and Henry Ledgard, Pascal Newsletter 6, page
- 70, November, 1976.)
-
- Small corrections were made to PRETTY by Charles Fischer, Dept.
- of Computer Science, University of Wisconsin, Madison, in 1977.
- PRETTY was modified for CDC-6000 Pascal by Rick L. Marcus, University
- Computer Center, University of Minnesota, in September, 1978.
-
- - 3 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- PASCAL PROGRAM FORMATTER
-
- - Michael N. Condict 1975 and 1978.
- - Rick L. Marcus 78/11/24.
- - Andy Mickel 78/12/01.
-
- What Spruce Does
- ----------------
-
- Spruce is a flexible prettyprinter for Pascal programs. It takes
- as input a syntactically-correct Pascal program and produces as output
- an equivalent but reformatted Pascal program. The resulting program
- consists of the same sequence of Pascal symbols and comments, but they
- are rearranged with respect to line boundaries and columns for
- readability.
-
- Spruce maintains consistent spacing between symbols, breaks
- control and data structures onto new lines if necessary, indents lines
- to reflect the syntactic level of statements and declarations, and
- more. Miscellaneous features such as supplying line-numbers and
- automatic comments, or deleting all unnecessary blanks to save space,
- are described below.
-
- The flexibility of Spruce is accomplished by allowing you to
- supply various directives (options) which override the default values.
- Rather than being a rigid prettyprinter which decides for you how your
- program is to be formatted, you have the ability to control how
- formatting is done. Not only can prettyprinter directives be given
- prior to execution ,but also during execution through the use of
- directives embedded in your program.
-
- Experience with Spruce over the last three years has shown that
- most users can find a set of values for the directives which produce
- satisfactory results. The default values are typical.
-
- How To Use Spruce
- -----------------
-
- Spruce is available as a KRONOS/NOS control statement on CDC
- 6000/Cyber 70,170 computer systems. Two parameters are required:
- "source", which is a correct (compilable) Pascal program to be
- prettyprinted, and "list", which is to be the reformatted version of
- the source program. The general form is:
-
- SPRUCE(source,list)
-
- or, if you wish to supply the initial values of Spruce directives on
- the control statement:
-
- SPRUCE(source,list/FormatterDirectiveList)
-
- See the section below for typical command sequences for running
- Spruce.
-
- Directives to Spruce may always be specified in the program
-
- - 1 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- itself inside comments with a special syntax. Thus the first line of
- a program is an ideal spot for a comment containing directives.
- Subsequent use of embedded directives allows you to change the kind of
- prettyprinting for different sections of your program. The syntax of
- these special comments is given below (The syntax is given using
- "EBNF"--Extended Backus-Naur Form--see Communications ACM, November,
- 1977, page 822.):
-
- DirectiveComment = "(*" DirectiveList "*)" |
- "(*$" CompilerOptionList CommentText DirectiveList "*)".
-
- DirectiveList = "[" Directive {"," Directive} "]" CommentText.
-
- Directive = Letter Setting.
-
- Letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" |
- "I" | "L" | "N" | "P" | "R" | "S" | "W".
-
- Setting = Switch | Value | Range.
-
- Switch = "+" | "-" .
-
- Value = "=" UnsignedInteger.
-
- Range = "=" UnsignedInteger "-" UnsignedInteger ["<" | ">"].
-
- UnsignedInteger = Digit{Digit}.
-
- CommentText = {Any character except "]" or close-comment}.
-
- Note: As defined above, a Directive may be within a comment
- specifying a Pascal CompilerOptionList. On most implementations this
- is a "$" followed by a series of letters and values ("+", "-", or
- digits), separated by commas. See your local manual.
-
- Examples of DirectiveComments:
-
- (*[A=15, E=3, N=1,1<]*) - good for publication quality.
- (*[G=0, W=1-100, C+]*) - good for compact storage.
- (*$U+ [R=1-72, I=2]*) - an example of a DirectiveList with a
- CompilerOptionList.
-
- Directives to Spruce
- --------------------
-
- A=n Align declarations.
- The A directive forces the alignment of ":" and "=" in
- declarations. If A is set to a value greater than 0, then n
- should be equal to the maximum identifier length for that
- section of your program. The A directive visually clarifies
- the declaration part of your program. See example below.
- Default: A=0 (no alignment).
-
- B+ or B- Bunch statements and declarations reasonably.
- B+ will place as many statements or declarations onto one
-
- - 2 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- line as will fit within the specified write margins (W
- directive) subject to readability constraints. Bunching (B+)
- when the display is off (D-) has no effect. In general, B+
- saves paper and prevents your program from becoming overly
- stretched in the vertical direction. See example below.
- Default: B- (one statement or statement part per line).
-
- C+ or C- Fully Compress program.
- C+ removes all non-essential blanks, end-of-lines, and com-
- ments from your program. A compilable, packed program will
- be written within the specified write margins (W directive).
- The number of spaces specified by the G directive will still
- be written between symbols. C+ might save some space on
- long-term storage media such as disk; you might store a
- program in compressed form and expand it later by reformat-
- ting with C-.
- Default: C-.
-
- D+ or D- Turn Display on or off.
- D allows you to selectively display portions of your program
- during prettyprinting. Therefore, D must be switched on and
- off with directives which are appropriately placed in your
- program. D is perhaps useful to obtain program fragments for
- publication (such as one or more procedures) without having
- to print the whole program.
- Default: D+.
-
- E=n Supply END comments.
- The E directive generates comments after "END" symbols if
- none are already there. Common Pascal coding styles fre-
- quently employ these comments. E=1 creates comments after
- the "END" symbol in compound statements which are within
- structured statements, as well as those constituting proce-
- dure and function bodies. The comments take the form:
- (*StatementPart*) or (*ProcedureName*). E=2 creates comments
- after the "BEGIN" and "END" symbols constituting procedure
- and function bodies only. E=0 creates no comments at all.
- E=3 means E=1 and E=2. See example below.
- Default: E=2.
-
- F+ or F- Turn Formatting (prettyprinting) on or off.
- F allows you to format selected portions of your program. F-
- causes Spruce to copy the input program directly with no
- changes. Therefore by switching F on and off with directives
- which are appropriately placed in your program, you can
- preserve text which is already properly formatted (such as
- comments).
- Default: F+ (of course!).
-
- G=n Specify symbol Gap.
- The G directive determines the number of spaces placed
- between Pascal symbols during prettyprinting. G=0 still
- places one space between two identifiers and reserved words.
- The symbols [ ] ( ) , and : are handled independently of G.
- Default: G=1.
-
-
- - 3 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- I=n Specify Indent tab.
- I indents each nesting level of statements and declarations a
- given number of columns. Using I=2 or I=1 helps prevent
- excessively-narrow lines within the specified write margins
- (W directive) where there are heavily-nested constructs.
- Default: I=3.
-
- L=n Specify Line-wraparound indent tab.
- L determines the indentation of the remainder of statements
- or declarations which are too long to fit on one line.
- Default: L=3.
-
- N=x-y< or N=x-y> Generate line-numbers on the left or right.
- The N directive indicates the starting line-number (x) and
- the increment (y) for each succeeding line-number. If y > 0
- then line-numbers are written outside the specified write
- margins for the formatted program in sequential order start-
- ing at x; y = 0 shuts off line-numbering. "<" writes up to
- 4-digit, right-justified line-numbers together with a trail-
- ing space to the left of each line. ">" writes 6-digit,
- zero-filled line-numbers to the right of each line. Use
- the N directive along with the W directive.
- Default: N=0-0> (no line-numbers).
-
- P=n Specify spacing between Procedure and function declarations.
- The P directive determines the number of blank lines to be
- placed between procedure and function declarations. n>2
- makes procedures and functions visually stand out.
- Default: P=2.
-
- R=x-y Specify Read margins.
- The R directive indicates which columns are significant when
- Spruce reads from input file. R allows Spruce to accept
- files which have line-numbers in the first (x-1) columns or
- after the yth column.
- Default: R=1-999 (large enough to read to end-of-line in
- most cases).
-
- S=n Specify Statement separation.
- The S directive determines the number of spaces between
- statements bunched on the same line by the use of the B+
- directive. Note that this directive is only in effect if B+
- is used.
- Default: S=3.
-
- W=x-y Specify Write margins.
- The W directive indicates which columns are used for writing
- the reformatted program on the output file. Any line-numbers
- generated (N directive) are written outside these margins.
- Default: W=1-72.
-
-
-
-
- - 4 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- Examples
- --------
-
- The A Directive
- ---------------
-
- Here is a sample program fragment before using Spruce:
-
- PROGRAM SAMPLE(OUTPUT);
- CONST A=6; ABC='LETTERS'; THREE=3;
- TYPE RANGE=1..6;
- COLOUR=(RED,BLUE);
- VAR
- I,I2,I33,I444,I5555:RANGE;
- YES,NO,MAYBE:BOOLEAN;
- BEGIN END.
-
- Here is the output from Spruce with all defaults set:
-
- PROGRAM SAMPLE(OUTPUT);
-
- CONST
- A = 6;
- ABC = 'LETTERS';
- THREE = 3;
-
- TYPE
- RANGE = 1 .. 6;
- COLOUR =
- (RED, BLUE);
-
- VAR
- I, I2, I33, I444, I5555: RANGE;
- YES, NO, MAYBE: BOOLEAN;
-
- BEGIN
- END (*SAMPLE*).
-
- Here is the output from Spruce having added a line with the A=5
- directive:
-
- (*[A=5] ALIGN DECLARATIONS. *)
- PROGRAM SAMPLE(OUTPUT);
-
- CONST
- A = 6;
- ABC = 'LETTERS';
- THREE = 3;
-
- TYPE
- RANGE = 1 .. 6;
- COLOUR = (RED, BLUE);
-
- VAR
- I,
- I2,
-
- - 5 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- I33,
- I444,
- I5555: RANGE;
- YES,
- NO,
- MAYBE: BOOLEAN;
-
- BEGIN
- END (*SAMPLE*).
-
- The B Directive
- ---------------
-
- If the input to Spruce is:
-
- PROGRAM T(OUTPUT);
- CONST INCREMENT = 5;
- VAR I,J,N:INTEGER;
- BEGIN
- N:=0;
- J:=3; I:=SQR(N); N:=N+INCREMENT;
- IF N>73 THEN BEGIN DOTHIS; DOTHAT END ;
- IF N>5 THEN IF J>6 THEN DOSOMETHINGELSE;
- END.
-
- then the output from Spruce (using the default, B-) is:
-
- PROGRAM T(OUTPUT);
-
- CONST
- INCREMENT = 5;
-
- VAR
- I, J, N: INTEGER;
-
- BEGIN
- N := 0;
- J := 3;
- I := SQR(N);
- N := N + INCREMENT;
- IF N > 73 THEN
- BEGIN
- DOTHIS;
- DOTHAT
- END;
- IF N > 5 THEN
- IF J > 6 THEN
- DOSOMETHINGELSE;
- END (*T*).
-
- and the output from Spruce with B directives embedded is:
-
- (*[B+] BUNCH STATEMENTS. *)
- PROGRAM T(OUTPUT);
-
- CONST
-
- - 6 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- INCREMENT = 5;
-
- VAR
- I, J, N: INTEGER;
-
- BEGIN
- N := 0; J := 3; I := SQR(N); N := N + INCREMENT;
- IF N > 73 THEN BEGIN DOTHIS; DOTHAT END;
- (*[B-] UNBUNCH. *)
- IF N > 5 THEN
- IF J > 6 THEN
- DOSOMETHINGELSE;
- END (*T*).
-
- The E Directive
- ---------------
-
- Suppose that a Pascal program fragment looked like:
-
- PROCEDURE SAMPLE;
- PROCEDURE INNER;
- BEGIN END;
- BEGIN
- IF X=3 THEN
- BEGIN X:=1; I:=I+1
- END
- ELSE
- BEGIN X:=X+I; I:=0
- END;
- WHILE (CH<>'X') AND FLAG1 DO
- BEGIN I:=I+3; INNER END;
- END;
-
- then using Spruce with E=3 produces:
-
- PROCEDURE SAMPLE;
-
- PROCEDURE INNER;
-
- BEGIN
- END (*INNER*);
-
- BEGIN (*SAMPLE*)
- IF X = 3
- THEN
- BEGIN
- X := 1;
- I := I + 1
- END (*IF*)
- ELSE
- BEGIN
- X := X + I;
- I := 0
- END (*ELSE*);
-
- - 7 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- WHILE (CH <> 'X') AND FLAG1 DO
- BEGIN
- I := I + 3;
- INNER
- END (*WHILE*);
- END (*SAMPLE*);
-
- How Spruce Works
- ----------------
-
- Spruce parses your program by performing syntax analysis similar
- to the Pascal compiler: recursive descent within nested declarations
- and statements. It gathers characters into a buffer in which the
- indenting count of each character is maintained. The characters are
- being continually emptied from the buffer as new ones are added.
-
- Spruce has limited error-recovery facilities, and no results are
- guaranteed if a syntactically-incorrect program is supplied as input.
-
- The bane of most Pascal prettyprinters is the treatment of
- comments. Spruce considers them in the context of a declaration or
- statement. Therefore using comments like:
-
- CONST LS=6 (*LINESIZE*);
-
- is a good idea because Spruce will carry the comment along with the
- declaration. Similarly:
-
- BEGIN (* 'Z' < CH <= ' ' *)
-
- is also okay.
-
- Stand-alone comments however, receive rough treatment. Spruce
- always left-justifies the first line of such comments and places it on
- a separate line. See the F directive. Thus:
-
- CONST LS=6; (*LINESIZE*)
-
- will be reformatted as:
-
- CONST
- LS = 6;
- (*LINESIZE*)
-
- Proper treatment of comments is certainly an area of future
- development for Spruce.
-
-
-
-
-
-
- - 8 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- Command Sequences
- -----------------
-
- For Interactive Processing:
-
- 1. A Pascal program is on the file "myprog", and the spruced-up
- listing is to be on the file "newprog":
-
- old,myprog -or- get,myprog (if "myprog" is not
- already a local file)
- x,rfl,20000
- x,spruce,myprog,newprog
- save,newprog
-
- "newprog" is now the spruced-up version of "myprog".
-
- 2. Rather than embedding directives into your program to change the
- default values, you desire to place them on the control statement:
-
- x,spruce,myprog,newprog/b+,s=2,i=2
-
- For Batch Processing:
-
- 3. A program is on cards (file INPUT) and the spruced-up program is
- to go to the printer (file OUTPUT). The command sequence is:
-
- Job Statement.
- USER Statement.
- SPRUCE.
- 7-8-9 end-of-record
-
- Pascal program
-
- 6-7-8-9 end-of-information
-
- 4. In the same run as a compile and execute, a Pascal program is
- spruced-up:
-
- Job Statement.
- USER Statement.
- SPRUCE,,TEMP. ("TEMP" here directs SPRUCE to put the pretty-
- printed results on a file named TEMP.)
- PASCAL,TEMP.
- LGO.
- 7-8-9 end-of-record
-
- Pascal program
-
- 7-8-9 end-of-record
-
- data, if any
-
- 6-7-8-9 end-of-information
-
-
- - 9 -
-
-
- SPRUCE - Pascal Program Formatter 03 Jan 79
-
- Spruce issues the following error messages:
-
- 1. " *** 'PROGRAM' EXPECTED."
- The Pascal program you fed to Spruce did not contain a standard
- Pascal program declaration.
-
- 2. " *** ERRORS FOUND IN PASCAL PROGRAM."
- Your program is syntactically incorrect. The output from Spruce
- probably does not contain all of the text from your input file. The
- cause could be any syntactic error, most commonly unmatched "BEGIN-
- END" pairs, or the lack of semicolons, string quotation marks, or the
- final period.
-
- 3. " *** STRING TOO LONG."
- Your program contains a character string (including both the
- quotes) which is wider than the specified write margins (W directive).
-
- 4. " *** NO PROGRAM FOUND TO FORMAT."
- The input file given to Spruce is empty.
-
- History
- -------
-
- Spruce was originally written under the name "Format" in 1975 by
- Michael Condict as a class project in a Pascal programming course
- taught by Richard Cichelli at Lehigh University using CDC-6000 Pascal.
- After that, making improvements and adding directives became, tempora-
- rily, an obsession with the author (note limited usefulness of the D
- directive). Fortunately, the program eventually stabilized and is now
- in general use by Pascal programmers at Lehigh University and other
- institutions. After graduation the author transported Format in 1977
- to a PDP-11 running under the Swedish Pascal compiler and RSX-11 with
- a total effort of 2 days.
-
- Spruce was modified for inclusion with Release 3 of CDC-6000
- Pascal by Rick L. Marcus and Andy Mickel, University Computer Center,
- University of Minnesota, in November, 1978.
-
-
-
-
-
-
-
-
-
-
- - 10 -
-
-
- WRITE - A Writeup-Oriented Character Set Translator 03 Jan 79
-
- WRITE - A Writeup-Oriented Character Set Translator.
-
- J. P. Strait
- University Computer Center
- University of Minnesota
-
- Copyright (C) University of Minnesota - 1978
-
- WRITE converts the Pascal 6000 writeups to any of a variety of
- destination character sets and output devices. The Pascal 6000
- writeups are maintained in CDC 6/12 ASCII character set and use the
- full ASCII character set. These writeups may be converted by using
- the "WRITE" program to be compatible with the character set(s) and
- output device(s) available at your site.
-
- The WRITE control statement has the following form:
-
- FETCH(WRITE)
- WRITE(input,output/options)
-
- the options are keywords which define various output characteristics.
- They are organized into 5 main groups.
-
- Main character set type:
- ------------------------
- ASC - CDC ASCII subset character set (TERM,TTY in KRONOS and NOS
- terminology). See APPENDIX below.
- SCI - CDC scientific character set (TERM,TTYD in KRONOS and NOS
- terminology).
- A95 - 8-in-12 bit ASCII - characters are printed as actual ASCII
- values, one in each 12-bit byte. The upper bit in the byte
- is always set. This form corresponds to SCOPE and NOS/BE 96
- character "IC=ASCII" character set.
-
- Destination printer type:
- -------------------------
- LPT - Line printer. Uses carriage control characters '1', '0',
- and '+'.
- TELEX - Interactive terminal under KRONOS and NOS. Carriage control
- characters are expanded and ASCII "CR" is used for over-
- printing.
- INTRCOM - Interactive terminal under SCOPE and NOS/BE. Carriage
- control characters are expanded but '+' is used for over-
- printing.
-
- Underlining ability:
- --------------------
- ULN - Underlining is possible on the output device.
- NOULN - Underlining is not possible on the output device.
-
-
- - 1 -
-
-
- WRITE - A Writeup-Oriented Character Set Translator 03 Jan 79
-
- 63/64 character set (ignored for A95 mode):
- -------------------------------------------
- 63 - The installation character set is 63 character set.
- 64 - The installation character set is 64 character set.
-
- KRONOS and NOS 6/12 character set (ignored for A95 mode):
- ---------------------------------------------------------
- NORMAL - Only 6-bit display code will be used. This is required for
- upper-case-only line printers.
- EXTEND - The extended 6/12 ASCII characters are used. This option
- should not be used under SCOPE or NOS/BE.
-
- The default control statement is:
-
- WRITE(INPUT,OUTPUT/ASC,LPT,EXTEND,63,ULN)
-
- although the default options may be changed to be more appropriate to
- a particular computer system.
-
- *** *** *** *** ***
-
- The input to WRITE is assumed to be a line-printer ready file.
- The only carriage control characters that WRITE recognizes are '1',
- '0', '+', and ' '. Lines which start with any other character are
- ignored. If the output is intended for a line-printer (see the
- configuration variables), WRITE begins by printing a line consisting
- of the character 'Q' to de-select auto-page-eject.
-
- WRITE reads the input file line by line, and converts to ASCII
- codes as its internal character set. Linefeeds (LF) are used as
- end-of-line characters, formfeeds (FF) are used as end-of-line fol-
- lowed by page eject, and carriage returns (CR) are used to represent
- over-printing. Thus if the correct translation is not already
- available in this program, it is relatively easy to add a new one.
-
- Note: Some combinations may not be meaningful under a particular
- operating system.
-
- As an example, any of the Pascal-related writeups (and some
- others as well) at the University of Minnesota can be reprocessed by
- WRITE:
-
- WRITEUP,PASCAL=*/PT=AS,L=TEMP.
- FETCH(WRITE)
- WRITE(TEMP/TELEX)
-
- This will produce a version of the writeup for an interactive
- terminal.
-
-
- - 2 -
-
-
- WRITE - A Writeup-Oriented Character Set Translator 03 Jan 79
-
- APPENDIX - ASCII Character Set Information
- ------------------------------------------
-
- Andy Mickel 78/08/17.
- University Computer Center
- University of Minnesota
-
- ASCII (American Standard Code for Information Interchange) is the
- American variant of an officially-recognized, standard, international
- character set called the ISO (International Standards Organization)
- set. It specifies an 8-bit code for 128 characters (7 bits + 1 bit
- used for parity). Within the ISO code there may exist national
- variants for certain symbols (such as the currency symbol: $ ). The
- 128 characters consist of 95 which print as single graphics and 33
- which are used for device control. The backspace control character is
- specifically used to allow overprinting of characters such as accents
- on some letters in foreign languages.
-
- ASCII is the only character set to receive formal approval in the
- United States, having been adopted unanimously (including IBM) within
- ANSI (American National Standards Institute) during the period
- 1963-65. Of course IBM then made no effort to change from EBCDIC
- (Extended Binary Coded Decimal Interchange Code), and so we in the
- computing field have 2 character sets to worry about.
-
- Nevertheless ASCII is widely accepted as the industry standard by
- an overwhelming number of computer manufacturers, and most modern
- equipment (namely interactive terminals and personal (micro)
- computers) use ASCII. Today's programming languages are defined in
- terms of ASCII.
-
- There are several official subsets of ASCII as well (which are
- presented below). The 63- and 64-character subsets are for 6-bit
- hardware representations onto which the other characters in full ASCII
- may be folded. Lower-case letters fold to upper case, curly braces to
- square brackets, etc. Even the keyboards of most interactive
- terminals exhibit the systematic ordering of ASCII for upper-case and
- control characters.
-
- The 63-character subset:
-
- 0 1 2 3 4 5 6 7 8 9
- A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
- + - * / =
- ( ) [ ] < > ^
- ' " ! ? ; : , .
- @ # $ & % _
- space
-
- The 64-character subset:
-
- the 63 set except [ and ] plus
- { } \
-
- The 66-character subset:
-
- - 3 -
-
-
- WRITE - A Writeup-Oriented Character Set Translator 03 Jan 79
-
-
- the 63 set plus
- { } \
-
- The 89-character subset:
-
- the 63 set plus
- a b c d e f g h i j k l m n o p q r s t u v w x y z
-
- The 95-character subset:
-
- the 89 set plus
- { } \ | ` ~
-
- The full 128-character set:
-
- the 95 set plus
- the 33 control characters:
-
- ACK (Acknowledge) FF (Form Feed)
- BEL (Bell) FS (File Separator)
- BS (Backspace) GS (Group Separator)
- CAN (Cancel) HT (Horizontal Tab)
- CR (Carriage Return) LF (Line Feed)
- DC1 (Device Control 1) NAK (Negative Acknowledge)
- DC2 (Device Control 2) NUL (Null)
- DC3 (Device Control 3) RS (Record Separator)
- DC4 (Device Control 4) SI (Shift In)
- DEL (Delete) SO (Shift Out)
- DLE (Data Link Escape) SOH (Start of Heading)
- EM (End of Medium) STX (Start of Text)
- ENQ (Enquiry) SUB (Substitute)
- EOT (End of Transmission) SYN (Synchronous Idle)
- ESC (Escape) US (Unit Separator)
- ETB (End of Transmission Block) VT (Vertical Tab)
- ETX (End of Text)
-
- 00 20 40 60 100 120 140 160
- ----------------------------------------
- 0 | NUL DLE 0 @ P ` p
- 1 | SOH DC1 ! 1 A Q a q
- 2 | STX DC2 " 2 B R b r
- 3 | ETX DC3 # 3 C S c s
- 4 | EOT DC4 $ 4 D T d t
- 5 | ENQ NAK % 5 E U e u
- 6 | ACK SYN & 6 F V f v
- 7 | BEL ETB ' 7 G W g w
- 10 | BS CAN ( 8 H X h x
- 11 | HT EM ) 9 I Y i y
- 12 | LF SUB * : J Z j z
- 13 | VT ESC + ; K [ k {
- 14 | FF FS , < L \ l |
- 15 | CR GS - = M ] m }
- 16 | SO RS . > N ^ n ~
- 17 | SI US / ? O _ o DEL
-
-
- - 4 -
-
-
- WRITE - A Writeup-Oriented Character Set Translator 03 Jan 79
-
- The 7-bit octal code for a character is the sum of the column
- and row numbers. For example, the code for the letter G is
- 7 + 100 = 107 octal.
-
-
- CDC KRONOS/NOS ASCII Representations (63-Character Set)
- ------------------------------------
-
- --------------------- -----------------------
- Internal Normal ASCII Internal Extended ASCII
- display ------------ display --------------
- 6/12-bit 7-bit 6/12-bit 7-bit
- octal char octal octal char octal
- --------------------- -----------------------
- 00 7600
- 01 A 101 7601 a 141
- 02 B 102 7602 b 142
- 03 C 103 7603 c 143
- 04 D 104 7604 d 144
- 05 E 105 7605 e 145
- 06 F 106 7606 f 146
- 07 G 107 7607 g 147
- 10 H 110 7610 h 150
- 11 I 111 7611 i 151
- 12 J 112 7612 j 152
- 13 K 113 7613 k 153
- 14 L 114 7614 l 154
- 15 M 115 7615 m 155
- 16 N 116 7616 n 156
- 17 O 117 7617 o 157
- 20 P 120 7620 p 160
- 21 Q 121 7621 q 161
- 22 R 122 7622 r 162
- 23 S 123 7623 s 163
- 24 T 124 7624 t 164
- 25 U 125 7625 u 165
- 26 V 126 7626 v 166
- 27 W 127 7627 w 167
- 30 X 130 7630 x 170
- 31 Y 131 7631 y 171
- 32 Z 132 7632 z 172
- 33 0 060 7633 { 173
- 34 1 061 7634 | 174
- 35 2 062 7635 } 175
- 36 3 063 7636 ~ 176
- 37 4 064 7637 DEL 177
- 40 5 065 7640 NUL 000
- 41 6 066 7641 SOH 001
- 42 7 067 7642 STX 002
- 43 8 070 7643 ETX 003
- 44 9 071 7644 EOT 004
- 45 + 053 7645 ENQ 005
- 46 - 055 7646 ACK 006
- 47 * 052 7647 BEL 007
- 50 / 057 7650 BS 010
-
- - 5 -
-
-
- WRITE - A Writeup-Oriented Character Set Translator 03 Jan 79
-
- 51 ( 050 7651 HT 011
- 52 ) 051 7652 LF 012
- 53 $ 044 7653 VT 013
- 54 = 075 7654 FF 014
- 55 SPACE 040 7655 CR 015
- 56 , 054 7656 SO 016
- 57 . 056 7657 SI 017
- 60 # 043 7660 DLE 020
- 61 [ 133 7661 DC1 021
- 62 ] 135 7662 DC2 022
- 63 : 072 7663 DC3 023
- 64 " 042 7664 DC4 024
- 65 _ 137 7665 NAK 025
- 66 ! 041 7666 SYN 026
- 67 & 046 7667 ETB 027
- 70 ' 047 7670 CAN 030
- 71 ? 077 7671 EM 031
- 72 < 074 7672 SUB 032
- 73 > 076 7673 ESC 033
- 74 @ 100 7674 FS 034
- 75 \ 134 7675 GS 035
- 76 ^ 136 7676 RS 036
- 77 ; 073 7677 US 037
- --------------------- 7400
- 7401 @ 100
- 7402 ^ 136
- 7403
- 7404 % 045
- 7405
- 7406
- 7407 ` 140
- -----------------------
-
- References
- ==========
-
- "A View of the History of the ISO Character Code"
- R. W. Bemer in HONEYWELL COMPUTER JOURNAL, Vol. 6, No. 4,
- 1972, pp 274-289.
-
- "Hints on Distributing Portable Software"
- William Waite in SOFTWARE PRACTICE AND EXPERIENCE, Vol. 5,
- 1975, pp 295-308.
-
- NOS 1.2 REFERENCE MANUAL VOLUME 1, CDC, Pub. No. 60435400,
- Appendix A.
-
-
-
-
-
-
- - 6 -
- /